package myTest;

import java.nio.ByteBuffer;

public class ByteBufferTest {
    public static void main(String[] args) {

        ByteBuffer byteBuffer = ByteBuffer.wrap("hello world".getBytes());

        while (byteBuffer.hasRemaining()) {
            System.out.print((char) byteBuffer.get());
        }
        System.out.println();
        byteBuffer.flip();
        byteBuffer.put("hello worlx".getBytes());
        byteBuffer.flip();
        while (byteBuffer.hasRemaining()) {
            System.out.print((char) byteBuffer.get());
        }



    }
}
